package com.lottery.im.widget.dialog;

import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatDialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;

public abstract class BaseDialogFragment extends AppCompatDialogFragment {
  public abstract int getResourceLayout();

  @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    Window window = getDialog().getWindow();
    WindowManager.LayoutParams windowParams = window.getAttributes();
    window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    window.setAttributes(windowParams);
  }

  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
      Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
    return inflater.inflate(getResourceLayout(), container, false);
  }

}
